package sql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
 * this class
 * @author Ron Shenkerman
 * @author Ivan Onyshchenko
 */
public class SQLConnection {

	private Connection connection; 
	private static String username= "root";
	//private static String password= "Braude";
	private static String password= "root";

	/**
	 * create connection to mysql
	 */
	public SQLConnection()
	{
		try {
			
			 Class.forName("com.mysql.jdbc.Driver").newInstance();
			}
		
		catch (Exception ex){
		}
		
		
		try {
	         connection  = DriverManager.getConnection("jdbc:mysql://localhost/mtl",username,password);
	        // System.out.println("SQL connection succeed");
			
			}
		
		catch (SQLException ex)
	 	    {		/* handle any errors*/
	    	   
	            System.out.println("SQLException: " + ex.getMessage());
	            System.out.println("SQLState: " + ex.getSQLState());
	            System.out.println("VendorError: " + ex.getErrorCode());
	         }
		
		
		
	}


public Connection getConnection(){
	return connection;
}


public static String getPassword() {
	return password;
}


public static void setPassword(String password) {
	SQLConnection.password = password;
}


public static String getUsername() {

	return username;
}


public static void setUsername(String username) {
	
	SQLConnection.username = username;
}



}
